Skip to content

feat(eng-12001): add metada commands (CRUD)#288

Open
BartoszBlizniak wants to merge 6 commits intomasterfrom
eng-12001-cli-standalone-metadata-command-group
Open

feat(eng-12001): add metada commands (CRUD)#288
BartoszBlizniak wants to merge 6 commits intomasterfrom
eng-12001-cli-standalone-metadata-command-group

Conversation

@BartoszBlizniak
Copy link
Copy Markdown
Member

Description

Adds a new cloudsmith metadata command group for managing metadata entries attached to packages.

The command group supports:

  • cloudsmith metadata list / ls to list metadata for a package, with optional
    --source-kind and --classification filters.
  • cloudsmith metadata list OWNER/REPO/PACKAGE METADATA_SLUG_PERM to retrieve a
    single metadata entry.
  • cloudsmith metadata add to attach metadata from inline JSON, a JSON file, or
    stdin.
  • cloudsmith metadata update to patch metadata content and/or source identity.
  • cloudsmith metadata remove / rm to delete metadata, guarded by the standard
    destructive action confirmation flow and -y/--yes.
May-01-2026 13-09-03

Example: list metadata for a package

cloudsmith metadata list your-org/awesome-repo/better-pkg

Example response:

Listing metadata for the 'better-pkg' package ... OK

Slug       | Content Type                            | Classification | Source Kind | Source Identity
abc123     | application/json                        | generic        | customer    | cloudsmith-cli@1.16.0
sbom456    | application/vnd.cyclonedx+json           | sbom           | customer    | ci:sbom

Results: 2 metadata entries visible

Example: add inline metadata

cloudsmith metadata add your-org/awesome-repo/better-pkg \
  --content-type application/json \
  --source-identity ci:release-42 \
  --content '{"release":"2026.05","commit":"abc123"}'

Example response:

Attaching metadata to the 'better-pkg' package ... OK

Slug       | Content Type     | Classification | Source Kind | Source Identity
meta789    | application/json | generic        | customer    | ci:release-42

Content:
{
  "commit": "abc123",
  "release": "2026.05"
}

Example: add build-info or SBOM metadata from a file

cloudsmith metadata add your-org/awesome-repo/better-pkg \
  --content-type application/vnd.jfrog.buildinfo+json \
  --source-identity ci:build-info \
  --file buildinfo.json

cloudsmith metadata add your-org/awesome-repo/better-pkg \
  --content-type application/vnd.cyclonedx+json \
  --source-identity ci:sbom \
  --file sbom.json

Example: invalid JSON returns a usage error before calling the API

cloudsmith metadata add your-org/awesome-repo/better-pkg \
  --content-type application/json \
  --content '{not json'

Example response:

Error: Invalid JSON in --content: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Refactoring
  • Other (please describe)

Additional Notes

CLI tests cover help text, list pagination and filters, JSON output, single-entry retrieval, inline/file/stdin content loading, invalid JSON handling, update argument validation, and remove confirmation behavior.

Local checks and testing completed.

Copilot AI review requested due to automatic review settings May 1, 2026 12:13
@BartoszBlizniak BartoszBlizniak requested a review from a team as a code owner May 1, 2026 12:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new cloudsmith metadata CLI command group to manage v2 package metadata entries (list/get/add/update/remove), including slug resolution via the existing packages API.

Changes:

  • Introduces cloudsmith metadata command group with CRUD subcommands, JSON/table output, pagination support, and destructive-action confirmation for removals.
  • Adds core.api.packages.get_package_slug_perm() helper to resolve a package’s permanent slug for metadata endpoints.
  • Adds CLI test coverage for help text, list pagination/filters, JSON output, content loading (inline/file/stdin), validation, update behavior, and remove confirmation.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
cloudsmith_cli/core/api/packages.py Adds get_package_slug_perm() to resolve a package slug_perm for downstream calls.
cloudsmith_cli/cli/commands/metadata.py Implements the new metadata command group and its subcommands (CRUD + formatting/content loading).
cloudsmith_cli/cli/commands/__init__.py Registers the new metadata command module so Click loads the group.
cloudsmith_cli/cli/tests/commands/test_metadata.py Adds a comprehensive test suite for the new command group.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloudsmith_cli/cli/commands/metadata.py
Comment thread cloudsmith_cli/cli/commands/metadata.py Outdated
Comment thread cloudsmith_cli/cli/commands/metadata.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants